Skip to content

This PR addresses four test improvements across the Soroban contracts and NestJS backend. - #1304

Merged
aji70 merged 6 commits into
MyFanss:mainfrom
Almikefred:main
Jun 26, 2026
Merged

This PR addresses four test improvements across the Soroban contracts and NestJS backend.#1304
aji70 merged 6 commits into
MyFanss:mainfrom
Almikefred:main

Conversation

@Almikefred

Copy link
Copy Markdown
Contributor

Summary

This PR addresses four test improvements across the Soroban contracts and NestJS backend. It adds a comprehensive full-lifecycle integration test for the earnings contract, verifies WASM builds in CI for
the test-consumer contract, introduces property-based invariant tests to catch edge cases, and completes controller unit tests with mocked services for the creators module.

Changes

#987 — Full lifecycle integration test via test-consumer

  • Added test_integration_full_lifecycle to earnings_integration test module
  • Tests complete workflow: initialize → record earnings → get balance → withdraw
  • Verifies state consistency after each step
  • Ensures multiple creators maintain independent balances
  • Confirms final state correctness (no funds leak, balances sum correctly)

#988 — WASM build verification for test-consumer in CI

  • Added wasm release build step for test-consumer contract to CI workflow
  • Follows exact same pattern as existing earnings contract build
  • Verifies test_consumer.wasm artifact builds cleanly
  • Includes comment explaining why wasm build is necessary (cargo test uses host target)
  • Prevents wasm-only build errors from slipping through CI

#989 — Property-based invariant tests for test-consumer

  • Added proptest v1 as dev-dependency with std feature
  • Implemented prop_invariant_balance_conservation: verifies that for any sequence of records and withdrawals, final balance = recorded - withdrawn, and balance >= 0
  • Implemented prop_invariant_read_function_idempotency: verifies that calling read-only functions (admin(), get_earnings()) twice returns identical results and doesn't change state
  • Both tests use proptest strategies to generate arbitrary valid amounts
  • Each iteration creates fresh Env to prevent state bleed between test cases

#990 — Creators controller unit tests with mocked service

  • Expanded creators.controller.spec.ts to cover all controller methods
  • Added tests for createPlan: valid input, invalid input scenarios
  • Added tests for getAllPlans: paginated results, empty results
  • Added tests for getPlans: creator with/without plans
  • Added tests for getDashboard: with query parameters, not-found error handling
  • Uses jest.fn() mocking pattern consistent with existing tests
  • Overrides JwtAuthGuard to isolate controller logic

Notes

  • Full lifecycle test determined from earnings contract lib.rs: init → record → get_earnings → withdraw
  • test-consumer package name confirmed from Cargo.toml, crate name test_consumer for .wasm artifact
  • proptest crate added (no existing fuzz testing dependency found)
  • Controller mock service pattern matched from existing test file setup
  • All controller methods confirmed from creators.controller.ts decorator routes
  • No co-author tags added to commits per requirement

Closes #987, Closes #988, Closes #989, Closes #990

@drips-wave

drips-wave Bot commented Jun 25, 2026

Copy link
Copy Markdown

@Almikefred Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@aji70
aji70 merged commit 963ae97 into MyFanss:main Jun 26, 2026
3 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants